package shellmodel

import (
	"fmt"
	"os/exec"
	"sync"
)

var Wg sync.WaitGroup

func OrangeUpsModify(envFlag,envTag,projectName,runUser string)  error {
	NgHost := "172.18.2.229"
	NgUser := "root"
	NgPort := "1662"
	//keyPath := "/Users/liangyawang/goproject/cmdb-go/shellmodel/id_rsa"
	keyPath := "/root/ssh/id_rsa"
	modifyNgConfCmd := fmt.Sprintf("ssh -o StrictHostKeyChecking=no -p%v %v@%v -i %v python3 /home/service/release/python/modify_ups.py %v %v %v %v",
		NgPort, NgUser, NgHost, keyPath, envFlag, envTag, projectName, runUser)
	cmdRes := exec.Command("/bin/bash","-c", modifyNgConfCmd)
	_,err := cmdRes.Output()
	//data,err := cmdRes.Output()
	//fmt.Println(string(data))
	if err != nil {
		fmt.Println("执行失败")
		return err
	} else {
		fmt.Println(envFlag,envTag,projectName,runUser,"配置文件修改完成")
		return err
	}
}
